package cn.jbolt.wdemo;

import cn.jbolt.core.model.AiApp;
import cn.jbolt.core.service.AiAppService;
import cn.jbolt.core.enums.AppType;
import com.jfinal.aop.Inject;
import com.jfinal.core.Controller;

public class WdemoAppIniter extends Controller {
    @Inject
    private AiAppService aiAppService;

    private void checkAndInitApp() {
        AiApp app = aiAppService.getById(WdemoAppConstrant.APP_ID);
        if (app != null) {
            return;
        }
        app = new AiApp();
        app.setId(WdemoAppConstrant.APP_ID);
        app.setBuildIn(false);
        app.setName(WdemoAppConstrant.APP_NAME);
        app.setSn(WdemoAppConstrant.APP_SN);
        app.setBriefInfo(WdemoAppConstrant.APP_BRIE_INFO);
        app.setAppType(AppType.SIMPLE.getCode());
        app.setEnable(true);
        aiAppService.save(app);
        initAppConfig(app);
        initAppNodes(app);
    }

    private void initAppConfig(AiApp app) {
        // 初始化应用配置
    }

    private void initAppNodes(AiApp app) {
        // 初始化应用节点
    }
} 